import pymysql;
class Store:
    

     conn=None
     
     def init():
         Store.conn = pymysql.connect( 
                   host='127.0.0.1',
                   user='root',
                   password='123456',
                   db='xiedu',
                   charset='utf8mb4',
                   cursorclass=pymysql.cursors.DictCursor
         )

     #存贮数据到数据库
     def save(info):
        # print(info)

        try:
            with Store.conn.cursor() as cursor:
                cursor.executemany("insert into content(title,text) values(%s,%s);", info)
            Store.conn.commit()
            return True
        except:
            return False


